class P10473 {

	public static void main(String[] args) {
		while (true) {
			String line = readLn();
			int index = line.indexOf('-'); 
			if (index > -1) {
				break;
			}
			if (line.startsWith("0x")) {
				System.out.println(Integer.parseInt(line.substring(2), 16));
			} else {
				System.out.println("0x" + Integer.toHexString(Integer.parseInt(line)).toUpperCase());
			}
		}
	}

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

}
